﻿<TrayWindowView
    x:Class="Poet.Views.TrayView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:converters="clr-namespace:Poet.Converters"
    Visibile="{Binding ShowInTray, Mode=TwoWay}"
    Icon="{Binding TrayIcon}">

    <TrayWindowView.ContextMenu>

        <ContextMenu Name="TrayMenu">

            <ContextMenu.Resources>
                <ResourceDictionary>
                    <ResourceDictionary.MergedDictionaries>
                        <ResourceDictionary Source="..\Resources\XamlStore.xaml" />
                        <ResourceDictionary Source="..\Resources\MenuResources.xaml" />
                    </ResourceDictionary.MergedDictionaries>
                    <converters:IsShownWindowStateToVisibilityConverter x:Key="IsShownWindowStateToVisibilityConverter"/>
                </ResourceDictionary>
            </ContextMenu.Resources>

            <MenuItem Header="{Localizing Show}" Command="{Binding Show}" CommandParameter="True" Visibility="{Binding WindowState, Converter={StaticResource IsShownWindowStateToVisibilityConverter}, ConverterParameter='True'}"/>
            <MenuItem Header="{Localizing Hide}" Command="{Binding Show}" CommandParameter="False" Visibility="{Binding WindowState, Converter={StaticResource IsShownWindowStateToVisibilityConverter}, ConverterParameter='False'}"/>
            <MenuItem Header="{Localizing Topmost}" IsCheckable="True" IsChecked="{ViewModel Topmost}" />
            <MenuItem Header="{Localizing ViewMode}" ItemsSource="{StaticResource ViewModeMenuItems}"/>
            <MenuItem Header="{Localizing Settings}">
                <MenuItem Header="{Localizing Autorun}" DataContext="{Binding SettingsViewModel}" IsCheckable="True" IsChecked="{Binding AutorunShortcut}" Style="{StaticResource AutoUpdateBindingsStyle}"/>
                <Separator/>
                <MenuItem Header="{Localizing DesktopShortcut}" IsCheckable="True" IsChecked="{Binding SettingsViewModel.DesktopLink}" StaysOpenOnClick="True" Style="{StaticResource AutoUpdateBindingsStyle}"/>
                <MenuItem Header="{Localizing ShowInTaskbar}" IsCheckable="True" IsChecked="{Binding ShowInTaskbar}" StaysOpenOnClick="True"/>
                <MenuItem Header="{Localizing ShowInTray}" IsCheckable="True" IsChecked="{Binding ShowInTray}" StaysOpenOnClick="True"/>
                <MenuItem Header="{Localizing Notification}">
                    <MenuItem Header="{Localizing OnlyShowNotifications}" Command="{Binding SetNotification}" CommandParameter="0" IsChecked="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanInvertConverter}}"/>
                    <MenuItem Header="{Localizing HideIconAndNotifications}" Command="{Binding SetNotification}" CommandParameter="1" IsChecked="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanInvertConverter}}"/>
                    <MenuItem Header="{Localizing ShowIconAndNotifications}" Command="{Binding SetNotification}" CommandParameter="2" IsChecked="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanInvertConverter}}"/>
                </MenuItem>
            </MenuItem>
            <Separator/>
            <MenuItem Header="{Localizing Exit}" Command="ApplicationCommands.Close" CommandParameter="App" Icon="{Picture Exit.png, 16}"/>

        </ContextMenu>

    </TrayWindowView.ContextMenu>

</TrayWindowView>